﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace QuanLyKhachSan
{
    public partial class UC_Phong_ThongTinPhong : System.Web.UI.UserControl
    {
        private int PhongID = -1;
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {   
                if (this.Request.QueryString["PhongID"] != null)
                {
                    PhongID = int.Parse(this.Request.QueryString["PhongID"].ToString());
                }
                if (!Page.IsPostBack)
                {
                    if (PhongID != -1)
                    {
                        Phong_Load(); 
                    }
                }
            }
            catch (Exception ex)
            {                
                throw ex;
            }
        }
        /// <summary>
        /// Phong_Load
        /// </summary>
        protected void Phong_Load()
        {
            try
            {
                PhongInfo item = PhongBLL.Phong_GetItem(PhongID);
                txtTenPhong.Text = item.PhongName;
                txtTienNghi.Text = item.TienNghiName;
                txtSoGiuong.Text = item.SoGiuong.ToString();
                txtSoNguoi.Text = item.SoNguoi.ToString();
            }
            catch (Exception ex)
            {                
                throw ex;
            }
        }
       
        
        protected void cmdOK_Click(object sender, EventArgs e)
        {
            try
            {
                //if (PhongID == -1)
                //{
                //    PhongBLL.Phong_Add(int.Parse(cbxLoaiPhong.SelectedValue.ToString()), txtTenPhong.Text, int.Parse(cbxTienNghi.SelectedValue.ToString()), int.Parse(txtSoGiuong.Text.ToString()), int.Parse(txtSoNguoi.Text.ToString()));
                //}
                //else
                //{
                //    PhongBLL.Phong_Edit(PhongID,int.Parse(cbxLoaiPhong.SelectedValue.ToString()), txtTenPhong.Text, int.Parse(cbxTienNghi.SelectedValue.ToString()), int.Parse(txtSoGiuong.Text.ToString()), int.Parse(txtSoNguoi.Text.ToString()));
                //}
                
            }
            catch (Exception ex)
            {                
                throw;
            }
        }
}
}
